package com.fancon.rage.comic.json.rpc;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;

import javax.servlet.http.HttpServlet;

import com.fancon.rage.comic.dao.RagePhotoDao;

import net.arnx.jsonic.JSON;
import net.arnx.jsonic.JSONException;
/**
 * Base JSON Service for encode enttity to json an return for client
 * @author binhbt
 *
 */
@SuppressWarnings("serial")
public class RageBaseService extends HttpServlet {

	protected Object decode(InputStream in, Class<? extends Object> cls)
			throws JSONException, IOException {
		return JSON.decode(in, cls);
	}

	protected Object decode(InputStream in, Type type) throws JSONException,
			IOException {
		return JSON.decode(in, type);
	}

	protected Object decode(InputStream in) throws JSONException, IOException {
		return JSON.decode(in);
	}
	protected String encode(Object obj)throws JSONException, IOException{
		return JSON.encode(obj);
	}
}
